import request from '@/utils/request'
import { getToken } from '@/utils/storage'

// 获取文章列表
export const getArticles = (obj) => {
  const token = getToken()
  return request.get('/articles', {
    params: {
      channel_id: obj.channel_id,
      timestamp: obj.timestamp
    },
    headers: {
      Authorization: `Bearer ${token}`
    }
  })
}

// 获取文章详情
export const getArticleDetail = (id) => {
  return request.get(`/articles/${id}`, {
    params: {
      id
    }
  })
}

export const followUser = (id) => {
  return request.post('/user/followings', {
    id,
    target: 1111
  })
}
